
package com.joysuch.wwyt.datadump.biz.model;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.zlg.common.datadump.annotation.DataDumpEntity;
import cn.zlg.common.datadump.annotation.DataDumpField;
import com.joysuch.wwyt.bp.entity.contractor.dsl.QBpContractor;
import com.joysuch.wwyt.bp.entity.dsl.QBpDepart;
import com.joysuch.wwyt.datadump.biz.convertor.ExportBaseTypeGroupItemNameBatchConvertor;
import com.joysuch.wwyt.datadump.biz.convertor.ImportBpContractorBusinessTypeConvertor;
import com.joysuch.wwyt.datadump.biz.convertor.JoinToStringConvertor;
import com.joysuch.wwyt.datadump.biz.convertor.JsonArrayStringToLongListConvertor;
import com.joysuch.wwyt.datadump.biz.processor.BpContractorImportProcessor;
import com.joysuch.wwyt.datadump.biz.query.BpContractorDumpQueryBean;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.time.LocalDate;

@DataDumpEntity(name = "bp-contractor-dump", entity = QBpContractor.class, exportQueryConditions = BpContractorDumpQueryBean.class,
        businessName = "承包商", batchDeleteField = "state", deleteFlagValue = "0", importProcessors = BpContractorImportProcessor.class)
@Data
public class BpContractorDumpBean {

    @NotNull
    @Excel(name = "承包商编号", width = 20)
    @DataDumpField(field = "code", importKey = true)
    @Length(max = 10)
    private String code;

    @NotNull
    @Excel(name = "承包商单位名称", width = 20)
    @DataDumpField(field = "companyName")
    private String companyName;

    @NotNull
    @Pattern(regexp = "合格承包商|不合格承包商|准承包商", message = "只能填写以下内容" + "\"合格承包商|不合格承包商|准承包商\"")
    @Excel(name = "承包商类别", width = 20)
    @DataDumpField(field = "contractorType")
    private String contractorType;

    @Excel(name = "承包商类型", width = 20)
    @DataDumpField(field = "businessType", exportConvertors = {JsonArrayStringToLongListConvertor.class,
            ExportBaseTypeGroupItemNameBatchConvertor.class, JoinToStringConvertor.class}, importConvertors = ImportBpContractorBusinessTypeConvertor.class)
    private String businessType;

    @NotNull
    @Excel(name = "管理部门", width = 20)
    @DataDumpField(field = "responsibleDept", referenceEntity = QBpDepart.class, referenceEntityField = "name")
    private String responsibleDeptName;

    @Excel(name = "承包商单位地址", width = 20)
    @DataDumpField(field = "companyAddress")
    private String companyAddress;

    @Excel(name = "法人", width = 20)
    @DataDumpField(field = "companyLegalPerson")
    private String companyLegalPerson;

    @Excel(name = "统一社会信用代码", width = 20)
    @DataDumpField(field = "unifiedSocialCreditCode")
    private String unifiedSocialCreditCode;

    @Excel(name = "承包商电话", width = 20)
    @DataDumpField(field = "contractorTel")
    private String contractorTel;

    @Excel(name = "邮箱", width = 20)
    @DataDumpField(field = "mail")
    private String mail;

    @Excel(name = "安全负责人", width = 20)
    @DataDumpField(field = "safetyDirector")
    private String safetyDirector;

    @Excel(name = "安全负责人电话", width = 20)
    @DataDumpField(field = "safetyDirectorTel")
    private String safetyDirectorTel;

    @Excel(name = "单位性质", width = 20)
    @DataDumpField(field = "unitNature")
    private String unitNature;

    @Excel(name = "公司介绍", width = 20)
    @DataDumpField(field = "companyIntroduction")
    private String companyIntroduction;

    @Excel(name = "经营范围", width = 20)
    @DataDumpField(field = "businessScope")
    private String businessScope;

    @Excel(name = "责任数签订日期", width = 20, format = "yyyy年MM月dd日")
    @DataDumpField(field = "dutyScriptSignDate")
    private LocalDate dutyScriptSignDate;

    @Excel(name = "责任书到期日期", width = 20, format = "yyyy年MM月dd日")
    @DataDumpField(field = "dutyScriptExpireDate")
    private LocalDate dutyScriptExpireDate;

}
